package com.rd.student.jike.class2.lihongming.week724_730.Day728;

/**
 * @Auther:Heinrich
 * @Date:2023/7/28-07-28-10:36
 * @Description:c230728
 * @version:1.0
 */
public class TestRecu {
    public static void main(String[] args) {

    }
    //f(n) = f(n-1) +f(n-2)
    public static int fib(int n){
        if(n==1)return 1;
        if(n==2)return 1;
        //写递归时先明确递推公式
        //f(5) = f(4) + f(3)
        int A = fib(n-1);
        int B = fib(n-2);
        return A+B;
    }
}
